CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/config/[...page].tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Layout } from "antd";
7
import { join } from "path";
8
9
import ConfigLayout from "components/account/config/layout";
10
import Footer from "components/landing/footer";
11
import Head from "components/landing/head";
12
import Header from "components/landing/header";
13
import { Paragraph } from "components/misc";
14
import A from "components/misc/A";
15
import basePath from "lib/base-path";
16
import { Customize } from "lib/customize";
17
import withCustomize from "lib/with-customize";
18
19
export default function Preferences({ customize, page }) {
20
function noteAboutConfig() {
21
return (
22
<Paragraph
23
type="secondary"
24
style={{
25
padding: "15px",
26
margin: 0,
27
textAlign: "center",
28
borderTop: `1px solid lightgray`,
29
}}
30
>
31
This is the account configuration page.{" "}
32
<A href={join(basePath, "settings")} external>
33
You can also adjust key preferences in the main app...
34
</A>
35
</Paragraph>
36
);
37
}
38
39
return (
40
<Customize value={customize}>
41
<Head title="Configuration" />
42
<Layout>
43
<Header page={"account"} />
44
<ConfigLayout page={page} />
45
{noteAboutConfig()}
46
<Footer />
47
</Layout>
48
</Customize>
49
);
50
}
51
52
export async function getServerSideProps(context) {
53
const { params, res } = context;
54
const { page = [] } = params;
55
56
const [_, sub] = page;
57
if (sub == null) {
58
return res.redirect(307, "./search/input");
59
}
60
61
return await withCustomize({ context, props: { page } });
62
}
63
64